﻿/********************************************************************
FileName    :   Bll_OS.cs
CreateTime  :   2020-11-09 08:14:31
BaseClass   :   Bll_OS
FileType    :   .cs
Author      :  minjie
*********************************************************************/


using System;
using System.Text;
using System.Data.SqlClient;
using System.Collections.Generic;

using System.Data;
namespace OS.DAL
{
    /// <summary>
    /// Dal_yw_pfdB的摘要说明。
    /// </summary>
    public partial class Dal_yw_pfdB
    {
        /// <summary> 
        /// 更新一条数据(字符串) 2016-07-13更新 
        ///   2020-04-09 更新 minjie 
        /// </summary> 
        public string UpdateStr(yw_pfdB_Entity model)
        {
		   StringBuilder strSql = new StringBuilder();
           strSql.Append("update yw_pfdB set ");
		
	     if (model.DjLsh != null) 
			 strSql.Append(" DjLsh ='" + model.DjLsh + "',");
	 
	     if (model.DjBth != null) 
			 strSql.Append(" DjBth ='" + model.DjBth + "',");
	 
	     if (model.DjState != null) 
			 strSql.Append(" DjState ='" + model.DjState + "',");
	 
	     if (model.hh != null) 
			 strSql.Append(" hh ='" + model.hh + "',");
	 
	     if (model.spbh != null) 
			 strSql.Append(" spbh ='" + model.spbh + "',");
	 
	     if (model.sptm != null) 
			 strSql.Append(" sptm ='" + model.sptm + "',");
	 
	     if (model.spmc != null) 
			 strSql.Append(" spmc ='" + model.spmc + "',");
	 
	     if (model.cjhh != null) 
			 strSql.Append(" cjhh ='" + model.cjhh + "',");
	 
	     if (model.gg != null) 
			 strSql.Append(" gg ='" + model.gg + "',");
	 
	     if (model.dw != null) 
			 strSql.Append(" dw ='" + model.dw + "',");
	 
	     if (model.ys != null) 
			 strSql.Append(" ys ='" + model.ys + "',");
	 
	     if (model.flh != null) 
			 strSql.Append(" flh ='" + model.flh + "',");
	 
	     if (model.flmc != null) 
			 strSql.Append(" flmc ='" + model.flmc + "',");
	 
	     if (model.xlbh != null) 
			 strSql.Append(" xlbh ='" + model.xlbh + "',");
	 
	     if (model.xlmc != null) 
			 strSql.Append(" xlmc ='" + model.xlmc + "',");
	 
	     if (model.sl != null) 
			 strSql.Append(" sl ='" + model.sl + "',");
	 
	     if (model.dj != null) 
			 strSql.Append(" dj ='" + model.dj + "',");
	 
	     if (model.je != null) 
			 strSql.Append(" je ='" + model.je + "',");
	 
	     if (model.jj != null) 
			 strSql.Append(" jj ='" + model.jj + "',");
	 
	     if (model.jjje != null) 
			 strSql.Append(" jjje ='" + model.jjje + "',");
	 
	     if (model.zhje != null) 
			 strSql.Append(" zhje ='" + model.zhje + "',");
	 
	     if (model.kcsl != null) 
			 strSql.Append(" kcsl ='" + model.kcsl + "',");
	 
	     if (model.ddwjsl != null) 
			 strSql.Append(" ddwjsl ='" + model.ddwjsl + "',");
	 
	     if (model.hzk != null) 
			 strSql.Append(" hzk ='" + model.hzk + "',");
	 
	     if (model.xsxc != null) 
			 strSql.Append(" xsxc ='" + model.xsxc + "',");
	 
	     if (model.hbz != null) 
			 strSql.Append(" hbz ='" + model.hbz + "',");
	 
	     if (model.sfdz != null) 
			 strSql.Append(" sfdz ='" + model.sfdz + "',");
	 
	     if (model.gysbh != null) 
			 strSql.Append(" gysbh ='" + model.gysbh + "',");
	 
	     if (model.pfj != null) 
			 strSql.Append(" pfj ='" + model.pfj + "',");
	 
	     if (model.bmbh1 != null) 
			 strSql.Append(" bmbh1 ='" + model.bmbh1 + "',");
	 
	     if (model.bmmc1 != null) 
			 strSql.Append(" bmmc1 ='" + model.bmmc1 + "',");
	 
	     if (model.gysmc != null) 
			 strSql.Append(" gysmc ='" + model.gysmc + "',");
	 
	     if (model.zhdj != null) 
			 strSql.Append(" zhdj ='" + model.zhdj + "',");
	 
	     if (model.dalsj != null) 
			 strSql.Append(" dalsj ='" + model.dalsj + "',");
	 
	     if (model.gyszk != null)
			 strSql.Append(" gyszk ='" + model.gyszk + "'");
			
	 
	    strSql.Append(" where  DjLsh ='" + model.DjLsh + "' ");
        return strSql.ToString();
        }
		
		/// <summary>
        /// 是否存在
        /// </summary>
        /// <param name="DjLsh">主键</param>
        /// <returns></returns>
        public bool Exists(int DjLsh)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(1) from yw_pfdB");  
            strSql.Append(" where   DjLsh =@DjLsh ");
            SqlParameter[] parameters = {  new SqlParameter("@DjLsh",SqlDbType.Int,4) };
            parameters[0].Value = DjLsh;
            return DbHelperSQL.Exists(strSql.ToString(), parameters);
        }
		/// <summary> 
        /// 增加一条数据 
        /// </summary> 
        public bool Add(yw_pfdB_Entity model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into yw_pfdB (");
			strSql.Append("DjLsh,DjBth,DjState,hh,spbh,sptm,spmc,cjhh,gg,dw,ys,flh,flmc,xlbh,xlmc,sl,dj,je,jj,jjje,zhje,kcsl,ddwjsl,hzk,xsxc,hbz,sfdz,gysbh,pfj,bmbh1,bmmc1,gysmc,zhdj,dalsj, gyszk) values (");
	        strSql.Append("@DjLsh,@DjBth,@DjState,@hh,@spbh,@sptm,@spmc,@cjhh,@gg,@dw,@ys,@flh,@flmc,@xlbh,@xlmc,@sl,@dj,@je,@jj,@jjje,@zhje,@kcsl,@ddwjsl,@hzk,@xsxc,@hbz,@sfdz,@gysbh,@pfj,@bmbh1,@bmmc1,@gysmc,@zhdj,@dalsj,@gyszk) ");  
	        SqlParameter[] parameters = {
	       
			new SqlParameter("@DjLsh",SqlDbType.Int,4),
	 
			new SqlParameter("@DjBth",SqlDbType.Int,4),
	 
			new SqlParameter("@DjState",SqlDbType.Char,10),
	 
			new SqlParameter("@hh",SqlDbType.Int,4),
	 
			new SqlParameter("@spbh",SqlDbType.VarChar,50),
	 
			new SqlParameter("@sptm",SqlDbType.VarChar,50),
	 
			new SqlParameter("@spmc",SqlDbType.VarChar,50),
	 
			new SqlParameter("@cjhh",SqlDbType.VarChar,50),
	 
			new SqlParameter("@gg",SqlDbType.Decimal,9),
	 
			new SqlParameter("@dw",SqlDbType.VarChar,50),
	 
			new SqlParameter("@ys",SqlDbType.VarChar,50),
	 
			new SqlParameter("@flh",SqlDbType.VarChar,50),
	 
			new SqlParameter("@flmc",SqlDbType.VarChar,50),
	 
			new SqlParameter("@xlbh",SqlDbType.VarChar,50),
	 
			new SqlParameter("@xlmc",SqlDbType.VarChar,50),
	 
			new SqlParameter("@sl",SqlDbType.Decimal,9),
	 
			new SqlParameter("@dj",SqlDbType.Decimal,9),
	 
			new SqlParameter("@je",SqlDbType.Decimal,9),
	 
			new SqlParameter("@jj",SqlDbType.Decimal,9),
	 
			new SqlParameter("@jjje",SqlDbType.Decimal,9),
	 
			new SqlParameter("@zhje",SqlDbType.Decimal,9),
	 
			new SqlParameter("@kcsl",SqlDbType.Decimal,9),
	 
			new SqlParameter("@ddwjsl",SqlDbType.Decimal,9),
	 
			new SqlParameter("@hzk",SqlDbType.Decimal,9),
	 
			new SqlParameter("@xsxc",SqlDbType.VarChar,50),
	 
			new SqlParameter("@hbz",SqlDbType.VarChar,50),
	 
			new SqlParameter("@sfdz",SqlDbType.VarChar,50),
	 
			new SqlParameter("@gysbh",SqlDbType.VarChar,50),
	 
			new SqlParameter("@pfj",SqlDbType.Decimal,9),
	 
			new SqlParameter("@bmbh1",SqlDbType.VarChar,50),
	 
			new SqlParameter("@bmmc1",SqlDbType.VarChar,50),
	 
			new SqlParameter("@gysmc",SqlDbType.VarChar,50),
	 
			new SqlParameter("@zhdj",SqlDbType.Decimal,9),
	 
			new SqlParameter("@dalsj",SqlDbType.Decimal,9),
	 
			new SqlParameter("@gyszk",SqlDbType.Decimal,9)
	 };
	 
	     if (model.DjLsh != null)
		 
            parameters[0].Value = model.DjLsh;
		else
		    parameters[0].Value =DBNull.Value;
	 
	     if (model.DjBth != null)
		 
            parameters[1].Value = model.DjBth;
		else
		    parameters[1].Value =DBNull.Value;
	 
	     if (model.DjState != null)
		 
            parameters[2].Value = model.DjState;
		else
		    parameters[2].Value =DBNull.Value;
	 
	     if (model.hh != null)
		 
            parameters[3].Value = model.hh;
		else
		    parameters[3].Value =DBNull.Value;
	 
	     if (model.spbh != null)
		 
            parameters[4].Value = model.spbh;
		else
		    parameters[4].Value =DBNull.Value;
	 
	     if (model.sptm != null)
		 
            parameters[5].Value = model.sptm;
		else
		    parameters[5].Value =DBNull.Value;
	 
	     if (model.spmc != null)
		 
            parameters[6].Value = model.spmc;
		else
		    parameters[6].Value =DBNull.Value;
	 
	     if (model.cjhh != null)
		 
            parameters[7].Value = model.cjhh;
		else
		    parameters[7].Value =DBNull.Value;
	 
	     if (model.gg != null)
		 
            parameters[8].Value = model.gg;
		else
		    parameters[8].Value =DBNull.Value;
	 
	     if (model.dw != null)
		 
            parameters[9].Value = model.dw;
		else
		    parameters[9].Value =DBNull.Value;
	 
	     if (model.ys != null)
		 
            parameters[10].Value = model.ys;
		else
		    parameters[10].Value =DBNull.Value;
	 
	     if (model.flh != null)
		 
            parameters[11].Value = model.flh;
		else
		    parameters[11].Value =DBNull.Value;
	 
	     if (model.flmc != null)
		 
            parameters[12].Value = model.flmc;
		else
		    parameters[12].Value =DBNull.Value;
	 
	     if (model.xlbh != null)
		 
            parameters[13].Value = model.xlbh;
		else
		    parameters[13].Value =DBNull.Value;
	 
	     if (model.xlmc != null)
		 
            parameters[14].Value = model.xlmc;
		else
		    parameters[14].Value =DBNull.Value;
	 
	     if (model.sl != null)
		 
            parameters[15].Value = model.sl;
		else
		    parameters[15].Value =DBNull.Value;
	 
	     if (model.dj != null)
		 
            parameters[16].Value = model.dj;
		else
		    parameters[16].Value =DBNull.Value;
	 
	     if (model.je != null)
		 
            parameters[17].Value = model.je;
		else
		    parameters[17].Value =DBNull.Value;
	 
	     if (model.jj != null)
		 
            parameters[18].Value = model.jj;
		else
		    parameters[18].Value =DBNull.Value;
	 
	     if (model.jjje != null)
		 
            parameters[19].Value = model.jjje;
		else
		    parameters[19].Value =DBNull.Value;
	 
	     if (model.zhje != null)
		 
            parameters[20].Value = model.zhje;
		else
		    parameters[20].Value =DBNull.Value;
	 
	     if (model.kcsl != null)
		 
            parameters[21].Value = model.kcsl;
		else
		    parameters[21].Value =DBNull.Value;
	 
	     if (model.ddwjsl != null)
		 
            parameters[22].Value = model.ddwjsl;
		else
		    parameters[22].Value =DBNull.Value;
	 
	     if (model.hzk != null)
		 
            parameters[23].Value = model.hzk;
		else
		    parameters[23].Value =DBNull.Value;
	 
	     if (model.xsxc != null)
		 
            parameters[24].Value = model.xsxc;
		else
		    parameters[24].Value =DBNull.Value;
	 
	     if (model.hbz != null)
		 
            parameters[25].Value = model.hbz;
		else
		    parameters[25].Value =DBNull.Value;
	 
	     if (model.sfdz != null)
		 
            parameters[26].Value = model.sfdz;
		else
		    parameters[26].Value =DBNull.Value;
	 
	     if (model.gysbh != null)
		 
            parameters[27].Value = model.gysbh;
		else
		    parameters[27].Value =DBNull.Value;
	 
	     if (model.pfj != null)
		 
            parameters[28].Value = model.pfj;
		else
		    parameters[28].Value =DBNull.Value;
	 
	     if (model.bmbh1 != null)
		 
            parameters[29].Value = model.bmbh1;
		else
		    parameters[29].Value =DBNull.Value;
	 
	     if (model.bmmc1 != null)
		 
            parameters[30].Value = model.bmmc1;
		else
		    parameters[30].Value =DBNull.Value;
	 
	     if (model.gysmc != null)
		 
            parameters[31].Value = model.gysmc;
		else
		    parameters[31].Value =DBNull.Value;
	 
	     if (model.zhdj != null)
		 
            parameters[32].Value = model.zhdj;
		else
		    parameters[32].Value =DBNull.Value;
	 
	     if (model.dalsj != null)
		 
            parameters[33].Value = model.dalsj;
		else
		    parameters[33].Value =DBNull.Value;
	 
	     if (model.gyszk != null)
		 
            parameters[34].Value = model.gyszk;
		else
		    parameters[34].Value =DBNull.Value;
	 
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
		/// <summary> 
        /// 增加一条数据(字符串) 
        /// </summary> 
        public string AddStr(yw_pfdB_Entity model)
        {
		    StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into yw_pfdB(");
			strSql.Append("DjLsh,DjBth,DjState,hh,spbh,sptm,spmc,cjhh,gg,dw,ys,flh,flmc,xlbh,xlmc,sl,dj,je,jj,jjje,zhje,kcsl,ddwjsl,hzk,xsxc,hbz,sfdz,gysbh,pfj,bmbh1,bmmc1,gysmc,zhdj,dalsj, gyszk) values (");
            strSql.Append("'" + model.DjLsh + "','" + model.DjBth + "','" + model.DjState + "','" + model.hh + "','" + model.spbh + "','" + model.sptm + "','" + model.spmc + "','" + model.cjhh + "','" + model.gg + "','" + model.dw + "','" + model.ys + "','" + model.flh + "','" + model.flmc + "','" + model.xlbh + "','" + model.xlmc + "','" + model.sl + "','" + model.dj + "','" + model.je + "','" + model.jj + "','" + model.jjje + "','" + model.zhje + "','" + model.kcsl + "','" + model.ddwjsl + "','" + model.hzk + "','" + model.xsxc + "','" + model.hbz + "','" + model.sfdz + "','" + model.gysbh + "','" + model.pfj + "','" + model.bmbh1 + "','" + model.bmmc1 + "','" + model.gysmc + "','" + model.zhdj + "','" + model.dalsj + "','" + model.gyszk + "') ");  
            return strSql.ToString();
        }
		/// <summary> 
        /// 更新一条数据 
		///创建时间:2020-04-09
		///创建人:minjie
        /// </summary> 
        public bool Update(yw_pfdB_Entity model)
        {
		   StringBuilder strSql = new StringBuilder();
           strSql.Append("update yw_pfdB set ");
		strSql.Append(" DjLsh = @DjLsh,");
		 
	 strSql.Append(" DjBth = @DjBth,");
		 
	 strSql.Append(" DjState = @DjState,");
		 
	 strSql.Append(" hh = @hh,");
		 
	 strSql.Append(" spbh = @spbh,");
		 
	 strSql.Append(" sptm = @sptm,");
		 
	 strSql.Append(" spmc = @spmc,");
		 
	 strSql.Append(" cjhh = @cjhh,");
		 
	 strSql.Append(" gg = @gg,");
		 
	 strSql.Append(" dw = @dw,");
		 
	 strSql.Append(" ys = @ys,");
		 
	 strSql.Append(" flh = @flh,");
		 
	 strSql.Append(" flmc = @flmc,");
		 
	 strSql.Append(" xlbh = @xlbh,");
		 
	 strSql.Append(" xlmc = @xlmc,");
		 
	 strSql.Append(" sl = @sl,");
		 
	 strSql.Append(" dj = @dj,");
		 
	 strSql.Append(" je = @je,");
		 
	 strSql.Append(" jj = @jj,");
		 
	 strSql.Append(" jjje = @jjje,");
		 
	 strSql.Append(" zhje = @zhje,");
		 
	 strSql.Append(" kcsl = @kcsl,");
		 
	 strSql.Append(" ddwjsl = @ddwjsl,");
		 
	 strSql.Append(" hzk = @hzk,");
		 
	 strSql.Append(" xsxc = @xsxc,");
		 
	 strSql.Append(" hbz = @hbz,");
		 
	 strSql.Append(" sfdz = @sfdz,");
		 
	 strSql.Append(" gysbh = @gysbh,");
		 
	 strSql.Append(" pfj = @pfj,");
		 
	 strSql.Append(" bmbh1 = @bmbh1,");
		 
	 strSql.Append(" bmmc1 = @bmmc1,");
		 
	 strSql.Append(" gysmc = @gysmc,");
		 
	 strSql.Append(" zhdj = @zhdj,");
		 
	 strSql.Append(" dalsj = @dalsj,");
		 
	 strSql.Append(" gyszk = @gyszk");
			
	 
		  strSql.Append(" where  DjLsh =@DjLsh ");
		  SqlParameter[] parameters = {
	       
			new SqlParameter("@DjLsh",SqlDbType.Int,4),
	 
			new SqlParameter("@DjBth",SqlDbType.Int,4),
	 
			new SqlParameter("@DjState",SqlDbType.Char,10),
	 
			new SqlParameter("@hh",SqlDbType.Int,4),
	 
			new SqlParameter("@spbh",SqlDbType.VarChar,50),
	 
			new SqlParameter("@sptm",SqlDbType.VarChar,50),
	 
			new SqlParameter("@spmc",SqlDbType.VarChar,50),
	 
			new SqlParameter("@cjhh",SqlDbType.VarChar,50),
	 
			new SqlParameter("@gg",SqlDbType.Decimal,9),
	 
			new SqlParameter("@dw",SqlDbType.VarChar,50),
	 
			new SqlParameter("@ys",SqlDbType.VarChar,50),
	 
			new SqlParameter("@flh",SqlDbType.VarChar,50),
	 
			new SqlParameter("@flmc",SqlDbType.VarChar,50),
	 
			new SqlParameter("@xlbh",SqlDbType.VarChar,50),
	 
			new SqlParameter("@xlmc",SqlDbType.VarChar,50),
	 
			new SqlParameter("@sl",SqlDbType.Decimal,9),
	 
			new SqlParameter("@dj",SqlDbType.Decimal,9),
	 
			new SqlParameter("@je",SqlDbType.Decimal,9),
	 
			new SqlParameter("@jj",SqlDbType.Decimal,9),
	 
			new SqlParameter("@jjje",SqlDbType.Decimal,9),
	 
			new SqlParameter("@zhje",SqlDbType.Decimal,9),
	 
			new SqlParameter("@kcsl",SqlDbType.Decimal,9),
	 
			new SqlParameter("@ddwjsl",SqlDbType.Decimal,9),
	 
			new SqlParameter("@hzk",SqlDbType.Decimal,9),
	 
			new SqlParameter("@xsxc",SqlDbType.VarChar,50),
	 
			new SqlParameter("@hbz",SqlDbType.VarChar,50),
	 
			new SqlParameter("@sfdz",SqlDbType.VarChar,50),
	 
			new SqlParameter("@gysbh",SqlDbType.VarChar,50),
	 
			new SqlParameter("@pfj",SqlDbType.Decimal,9),
	 
			new SqlParameter("@bmbh1",SqlDbType.VarChar,50),
	 
			new SqlParameter("@bmmc1",SqlDbType.VarChar,50),
	 
			new SqlParameter("@gysmc",SqlDbType.VarChar,50),
	 
			new SqlParameter("@zhdj",SqlDbType.Decimal,9),
	 
			new SqlParameter("@dalsj",SqlDbType.Decimal,9),
	 
			new SqlParameter("@gyszk",SqlDbType.Decimal,9)
	 };
	 
	     if (model.DjLsh != null)
		 
            parameters[0].Value = model.DjLsh;
		else
		    parameters[0].Value =DBNull.Value;
	 
	     if (model.DjBth != null)
		 
            parameters[1].Value = model.DjBth;
		else
		    parameters[1].Value =DBNull.Value;
	 
	     if (model.DjState != null)
		 
            parameters[2].Value = model.DjState;
		else
		    parameters[2].Value =DBNull.Value;
	 
	     if (model.hh != null)
		 
            parameters[3].Value = model.hh;
		else
		    parameters[3].Value =DBNull.Value;
	 
	     if (model.spbh != null)
		 
            parameters[4].Value = model.spbh;
		else
		    parameters[4].Value =DBNull.Value;
	 
	     if (model.sptm != null)
		 
            parameters[5].Value = model.sptm;
		else
		    parameters[5].Value =DBNull.Value;
	 
	     if (model.spmc != null)
		 
            parameters[6].Value = model.spmc;
		else
		    parameters[6].Value =DBNull.Value;
	 
	     if (model.cjhh != null)
		 
            parameters[7].Value = model.cjhh;
		else
		    parameters[7].Value =DBNull.Value;
	 
	     if (model.gg != null)
		 
            parameters[8].Value = model.gg;
		else
		    parameters[8].Value =DBNull.Value;
	 
	     if (model.dw != null)
		 
            parameters[9].Value = model.dw;
		else
		    parameters[9].Value =DBNull.Value;
	 
	     if (model.ys != null)
		 
            parameters[10].Value = model.ys;
		else
		    parameters[10].Value =DBNull.Value;
	 
	     if (model.flh != null)
		 
            parameters[11].Value = model.flh;
		else
		    parameters[11].Value =DBNull.Value;
	 
	     if (model.flmc != null)
		 
            parameters[12].Value = model.flmc;
		else
		    parameters[12].Value =DBNull.Value;
	 
	     if (model.xlbh != null)
		 
            parameters[13].Value = model.xlbh;
		else
		    parameters[13].Value =DBNull.Value;
	 
	     if (model.xlmc != null)
		 
            parameters[14].Value = model.xlmc;
		else
		    parameters[14].Value =DBNull.Value;
	 
	     if (model.sl != null)
		 
            parameters[15].Value = model.sl;
		else
		    parameters[15].Value =DBNull.Value;
	 
	     if (model.dj != null)
		 
            parameters[16].Value = model.dj;
		else
		    parameters[16].Value =DBNull.Value;
	 
	     if (model.je != null)
		 
            parameters[17].Value = model.je;
		else
		    parameters[17].Value =DBNull.Value;
	 
	     if (model.jj != null)
		 
            parameters[18].Value = model.jj;
		else
		    parameters[18].Value =DBNull.Value;
	 
	     if (model.jjje != null)
		 
            parameters[19].Value = model.jjje;
		else
		    parameters[19].Value =DBNull.Value;
	 
	     if (model.zhje != null)
		 
            parameters[20].Value = model.zhje;
		else
		    parameters[20].Value =DBNull.Value;
	 
	     if (model.kcsl != null)
		 
            parameters[21].Value = model.kcsl;
		else
		    parameters[21].Value =DBNull.Value;
	 
	     if (model.ddwjsl != null)
		 
            parameters[22].Value = model.ddwjsl;
		else
		    parameters[22].Value =DBNull.Value;
	 
	     if (model.hzk != null)
		 
            parameters[23].Value = model.hzk;
		else
		    parameters[23].Value =DBNull.Value;
	 
	     if (model.xsxc != null)
		 
            parameters[24].Value = model.xsxc;
		else
		    parameters[24].Value =DBNull.Value;
	 
	     if (model.hbz != null)
		 
            parameters[25].Value = model.hbz;
		else
		    parameters[25].Value =DBNull.Value;
	 
	     if (model.sfdz != null)
		 
            parameters[26].Value = model.sfdz;
		else
		    parameters[26].Value =DBNull.Value;
	 
	     if (model.gysbh != null)
		 
            parameters[27].Value = model.gysbh;
		else
		    parameters[27].Value =DBNull.Value;
	 
	     if (model.pfj != null)
		 
            parameters[28].Value = model.pfj;
		else
		    parameters[28].Value =DBNull.Value;
	 
	     if (model.bmbh1 != null)
		 
            parameters[29].Value = model.bmbh1;
		else
		    parameters[29].Value =DBNull.Value;
	 
	     if (model.bmmc1 != null)
		 
            parameters[30].Value = model.bmmc1;
		else
		    parameters[30].Value =DBNull.Value;
	 
	     if (model.gysmc != null)
		 
            parameters[31].Value = model.gysmc;
		else
		    parameters[31].Value =DBNull.Value;
	 
	     if (model.zhdj != null)
		 
            parameters[32].Value = model.zhdj;
		else
		    parameters[32].Value =DBNull.Value;
	 
	     if (model.dalsj != null)
		 
            parameters[33].Value = model.dalsj;
		else
		    parameters[33].Value =DBNull.Value;
	 
	     if (model.gyszk != null)
		 
            parameters[34].Value = model.gyszk;
		else
		    parameters[34].Value =DBNull.Value;
	 
	             int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
		/// <summary> 
        /// 删除一条数据 
        /// </summary> 
        public bool Delete(int DjLsh)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete from yw_pfdB ");
            strSql.Append(" where   DjLsh =@DjLsh ");
            SqlParameter[] parameters = {  new SqlParameter("@DjLsh",SqlDbType.Int,4) };
            parameters[0].Value = DjLsh;
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
		/// <summary> 
        /// 批量删除一批数据 
        /// </summary> 
        public bool DeleteList(string lists)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete from sys_Config ");
            strSql.Append(" where DjLsh in (" + lists + ")  ");
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString());
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
		
		/// <summary> 
        /// 得到一个对象实体 
        /// </summary> 
        public yw_pfdB_Entity GetModel(int DjLsh)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select top 1  DjLsh,DjBth,DjState,hh,spbh,sptm,spmc,cjhh,gg,dw,ys,flh,flmc,xlbh,xlmc,sl,dj,je,jj,jjje,zhje,kcsl,ddwjsl,hzk,xsxc,hbz,sfdz,gysbh,pfj,bmbh1,bmmc1,gysmc,zhdj,dalsj, gyszk ");
            strSql.Append(" from yw_pfdB ");
            yw_pfdB_Entity model = new yw_pfdB_Entity();
            DataSet ds = DbHelperSQL.Query(strSql.ToString());
            DataTable dt = ds.Tables[0];
            return DataTableToEntity(dt);
        }
		/// <summary> 
        /// 将数据集(DataTable)转换 对象 yw_pfdB_Entity
        /// 创建人：minjie 
        /// 创建时间:2019-02-18 02:05:58 
        /// </summary> 
        public yw_pfdB_Entity DataTableToEntity(DataTable dt)
        {
          yw_pfdB_Entity model = new yw_pfdB_Entity();
            if (dt != null && dt.Rows.Count > 0)
            {
		    
			   if (dt.Rows[0]["DjLsh"] != null && dt.Rows[0]["DjLsh"].ToString() != "")
                model.DjLsh = int.Parse(dt.Rows[0]["DjLsh"].ToString());
			  
	        
			   if (dt.Rows[0]["DjBth"] != null && dt.Rows[0]["DjBth"].ToString() != "")
                model.DjBth = int.Parse(dt.Rows[0]["DjBth"].ToString());
			  
	        model.DjState = dt.Rows[0]["DjState"].ToString();
	        
			   if (dt.Rows[0]["hh"] != null && dt.Rows[0]["hh"].ToString() != "")
                model.hh = int.Parse(dt.Rows[0]["hh"].ToString());
			  
	        model.spbh = dt.Rows[0]["spbh"].ToString();
	        model.sptm = dt.Rows[0]["sptm"].ToString();
	        model.spmc = dt.Rows[0]["spmc"].ToString();
	        model.cjhh = dt.Rows[0]["cjhh"].ToString();
	        if (dt.Rows[0]["gg"] != null && dt.Rows[0]["gg"].ToString() != "")
			  model.gg = decimal.Parse(dt.Rows[0]["gg"].ToString());
			
	        model.dw = dt.Rows[0]["dw"].ToString();
	        model.ys = dt.Rows[0]["ys"].ToString();
	        model.flh = dt.Rows[0]["flh"].ToString();
	        model.flmc = dt.Rows[0]["flmc"].ToString();
	        model.xlbh = dt.Rows[0]["xlbh"].ToString();
	        model.xlmc = dt.Rows[0]["xlmc"].ToString();
	        if (dt.Rows[0]["sl"] != null && dt.Rows[0]["sl"].ToString() != "")
			  model.sl = decimal.Parse(dt.Rows[0]["sl"].ToString());
			
	        if (dt.Rows[0]["dj"] != null && dt.Rows[0]["dj"].ToString() != "")
			  model.dj = decimal.Parse(dt.Rows[0]["dj"].ToString());
			
	        if (dt.Rows[0]["je"] != null && dt.Rows[0]["je"].ToString() != "")
			  model.je = decimal.Parse(dt.Rows[0]["je"].ToString());
			
	        if (dt.Rows[0]["jj"] != null && dt.Rows[0]["jj"].ToString() != "")
			  model.jj = decimal.Parse(dt.Rows[0]["jj"].ToString());
			
	        if (dt.Rows[0]["jjje"] != null && dt.Rows[0]["jjje"].ToString() != "")
			  model.jjje = decimal.Parse(dt.Rows[0]["jjje"].ToString());
			
	        if (dt.Rows[0]["zhje"] != null && dt.Rows[0]["zhje"].ToString() != "")
			  model.zhje = decimal.Parse(dt.Rows[0]["zhje"].ToString());
			
	        if (dt.Rows[0]["kcsl"] != null && dt.Rows[0]["kcsl"].ToString() != "")
			  model.kcsl = decimal.Parse(dt.Rows[0]["kcsl"].ToString());
			
	        if (dt.Rows[0]["ddwjsl"] != null && dt.Rows[0]["ddwjsl"].ToString() != "")
			  model.ddwjsl = decimal.Parse(dt.Rows[0]["ddwjsl"].ToString());
			
	        if (dt.Rows[0]["hzk"] != null && dt.Rows[0]["hzk"].ToString() != "")
			  model.hzk = decimal.Parse(dt.Rows[0]["hzk"].ToString());
			
	        model.xsxc = dt.Rows[0]["xsxc"].ToString();
	        model.hbz = dt.Rows[0]["hbz"].ToString();
	        model.sfdz = dt.Rows[0]["sfdz"].ToString();
	        model.gysbh = dt.Rows[0]["gysbh"].ToString();
	        if (dt.Rows[0]["pfj"] != null && dt.Rows[0]["pfj"].ToString() != "")
			  model.pfj = decimal.Parse(dt.Rows[0]["pfj"].ToString());
			
	        model.bmbh1 = dt.Rows[0]["bmbh1"].ToString();
	        model.bmmc1 = dt.Rows[0]["bmmc1"].ToString();
	        model.gysmc = dt.Rows[0]["gysmc"].ToString();
	        if (dt.Rows[0]["zhdj"] != null && dt.Rows[0]["zhdj"].ToString() != "")
			  model.zhdj = decimal.Parse(dt.Rows[0]["zhdj"].ToString());
			
	        if (dt.Rows[0]["dalsj"] != null && dt.Rows[0]["dalsj"].ToString() != "")
			  model.dalsj = decimal.Parse(dt.Rows[0]["dalsj"].ToString());
			
	        if (dt.Rows[0]["gyszk"] != null && dt.Rows[0]["gyszk"].ToString() != "")
			  model.gyszk = decimal.Parse(dt.Rows[0]["gyszk"].ToString());
			
	        
                return model;
            }
            else
            {
                return null;
            }
        }
		
		
		
		/// <summary> 
        /// 执行sql语句  
        /// </summary> 
        public string GetSingle(string sql)
        {
            object obj = DbHelperSQL.GetSingle(sql);
            if (obj != null)
            {
                return obj.ToString();
            }
            else
                return "";
        }
			/// <summary> 
  		/// 直接执行sql语句 
  		/// </summary> 
  		public int ExecuteSql(string sql) 
  		{ 
  			return DbHelperSQL.ExecuteSql(sql); 
  		} 
   
 
   
  		/// <summary> 
  		/// 直接执行sql语句 
  		/// </summary> 
  		public DataTable ExecuteDt(string sql) 
  		{ 
  			return DbHelperSQL.ExecuteDt(sql); 
  		} 
		
		/// <summary> 
        /// 获得记录条数 
        /// </summary> 
        public int GetRecordCount(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(1) ");
            strSql.Append(" FROM yw_pfdB ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            object obj = DbHelperSQL.GetSingle(strSql.ToString());
            if (obj != null && obj.ToString() != "")
                return Convert.ToInt32(obj);
            else
                return 0;
        }
		/// <summary> 
        /// 批量处理  
        /// </summary> 
        public int ExecuteSqlTran(List<string> ls, ref string error)
        {
            return DbHelperSQL.ExecuteSqlTran(ls, ref error);
        }
		/// <summary> 
        /// 分页获取数据列表 
        /// </summary> 
        public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("SELECT * FROM ( ");
            strSql.Append(" SELECT ROW_NUMBER() OVER (");
            if (!string.IsNullOrEmpty(orderby.Trim()))
            {
                strSql.Append("order by " + orderby);
            }
            else
            {
                strSql.Append("order by T.DjLsh desc");
            }
            strSql.Append(")AS Row, T.*  from yw_pfdB  T ");
            if (!string.IsNullOrEmpty(strWhere.Trim()))
            {
                strSql.Append(" WHERE " + strWhere);
            }
            strSql.Append(" ) TT");
            strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex); 
			return DbHelperSQL.Query(strSql.ToString());
        }
		/// <summary> 
        /// 获得数据列表 
        /// </summary> 
        public DataSet GetList(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select * ");
            strSql.Append(" FROM yw_pfdB ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            return DbHelperSQL.Query(strSql.ToString());
        }
	}
}
		